var urlMap = null;
/**
 * 外部调用boxy的统一接口
 * @param appid
 * @param options
 * @return
 */
function boxyFacade(appid,callback) {
	if(urlMap == null) {
		urlMap = new URLMap();	
	}
	var options = urlMap.getAppOptions(appid);
	options = $.extend({'callback':callback},options);
	qBox.iFrame(options);
}
/**
 * 存储appid到页面url的映射
 * @return
 */
function URLMap(){
	if(this.map == null) {
		this.map = new HashMap();
	}
	
	
	this.getAppOptions=function(appid){
		return this.map.get(appid);
	}
	
	
	var maxWidth = (document.body.scrollWidth - 10) + 'px';
	var maxHeight = (document.body.scrollHeight-75) + 'px';
	
	var _centerX = document.body.clientWidth / 2 - 8;
    var _centerY = document.body.clientHeight / 2 + 15; 
    
    this.map.put("buyUpdate_App3",{src:'apps/buyUpdate/buyUpdate.html',title:'续费升级',
		windowMinSize:{wMinWidth:'900px',wMinHeight:'550px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY - 20},appid:'buyUpdate_App3',maxable:'false'});
 
    
	this.map.put("marketingManager_App6",{src:'apps/marketingManager/marketingManager.jsp',title:'微博营销',
		windowMinSize:{wMinWidth:'500px',wMinHeight:'250px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY - 100},appid:'marketingManager_App6',maxable:'false'});
	
	this.map.put("StatReport_App2",{src:'apps/StatReport/statReport.jsp',title:'流量统计',
		windowMinSize:{wMinWidth:'1000px',wMinHeight:'550px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'StatReport_App2',maxable:'false'});
	
	this.map.put("personalSettings_App7",{src:'pc/personmgnt/enterPersonal.do',title:'个人设置',
		windowMinSize:{wMinWidth:'400px',wMinHeight:'250px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY-60},appid:'personalSettings_App7',maxable:'false'});
	
	this.map.put("contactPerson_App8",{src:'pc/friendmgnt/enterFriend.do',title:'粉丝管理',
		windowMinSize:{wMinWidth:'650px',wMinHeight:'450px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'contactPerson_App8',maxable:'false'});
	
	this.map.put("messageService_App9",{src:'apps/messageService/weiboPublish.jsp',title:'微博发送',
		windowMinSize:{wMinWidth:'680px',wMinHeight:'350px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY-30},appid:'messageService_App9',maxable:'false'});	
	
	this.map.put("streamManager_App12",{src:'apps/streamManager/streamManager.jsp',title:'微博管理',
										windowMinSize:{wMinWidth:maxWidth,wMinHeight:maxHeight},
										windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
										central:{centerX:_centerX+5,centerY:_centerY},
										appid:'streamManager_App12',maxable:false,draggable:true});
	
	this.map.put("marketingManager_App6_child_retweet", {src:'pc/marketingmgnt/retweetDiscount/listItemOnSale.do',title:'转发打折',
		windowMinSize:{wMinWidth:'800px',wMinHeight:'500px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'marketingManager_App6_child_retweet',draggable:'true',maxable:'false'});
	this.map.put("marketingManager_App6_child_discountVolume", {src:'marketingmgnt/coupon/getActivities.do',title:'活动推荐',
		windowMinSize:{wMinWidth:'900px',wMinHeight:'550px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'marketingManager_App6_child_discountVolume',draggable:'true',maxable:'false'});
	this.map.put("marketingManager_App6_child_newItemRecomment", {src:'marketingmgnt/newItemRecomment/getNewItem.do?pageNo=1&forwordUrl=marketingManager/childApp/newItemRecomment/Itemlist',title:'宝贝推荐',
		windowMinSize:{wMinWidth:'900px',wMinHeight:'550px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'marketingManager_App6_child_newItemRecomment',draggable:'true',maxable:'false'});
	this.map.put("marketingManager_App6_child_automarketing", {src:'apps/marketingManager/childApp/autoMarekting/autoMarketing.jsp',title:'自动营销',
		windowMinSize:{wMinWidth:'850px',wMinHeight:'550px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'marketingManager_App6_child_automarketing',draggable:'true',maxable:'false'});
	this.map.put("help_App13", {src:'apps/useHelper/useHelp.html',title:'系统使用帮助',scroll:"auto",
		windowMinSize:{wMinWidth:'800px',wMinHeight:'500px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'help_App13',draggable:'true',maxable:true});
	
	this.map.put("NoticeManager_App11", {src:'apps/notice/publishNotice.jsp',title:'公告管理',scroll:"auto",
		windowMinSize:{wMinWidth:'800px',wMinHeight:'500px'},
		windowMaxSize:{wMaxWidth:maxWidth,wMaxHeight:maxHeight},
		central:{centerX:_centerX,centerY:_centerY},appid:'NoticeManager_App11',draggable:'true',maxable:false});
}


/**
 * hashmap类
 * @return
 */
function HashMap(){  
    data={};  
    var size=0;  
    //清除所有的值
    this.clear=function(){  
         data={};  
    }  
    /** 
     * 判断key是否存在 
     * @param key 
     * @return Boolean  
     */  
    this.containsKey=function(key){  
        return Boolean(key in data);  
    }  
    /** 
     * 判断值是否存在 
     * @param value 
     * @return Boolean 
     */  
    this.containsValue=function(key){  
        var str=data.toSource();  
        return str.indexOf(key)==-1 ? false: true;  
    }  
    /** 
     * 返回key对应的v 
     */  
    this.get=function(key){  
        return data[key];  
    }  
    /** 
     * 判断是否为空 
     * @return Boolean 
     */  
    this.isEmpty=function(){  
        return size==0? true:false;  
    }  
    /** 
     * 取出所有的key 
     * @return Array() 
     */  
    this.keySet=function(){  
        var arr=new Array();  
        for(var i in data){  
            arr.push(i);  
        }  
        return arr;  
    }  
    /** 
     * 将key，value放入对象 
     * @param key  
     * @param value 
     */  
    this.put=function(key,value){  
        data[key]=value;  
        if(!this.containsKey(key)){  
             size++;  
        }  
         
    }  
    /** 
     * 删除key对应的value 
     * @param key 
     * @return value与 key 关联的旧值 
     */  
    this.remove=function(key){  
        var o=this.get(key);  
        if(o){  
            delete data[o];  
            return o;  
        }else{  
            return null;  
        }  
    }  
    /** 
     * 返回此HashMap的大小 
     * @reaturn Int 
     */  
    this.size=function(){  
        return size;  
    }  
    /** 
     * 返回此map所有的value集合 
     * @return Connections 
     */  
    this.values=function(){  
        var arr=new Array();  
        for (var i in data) {  
            arr.push(data[i])  
        }  
        return arr;  
    }  
    
    /**
     * 返回此map
     */
    this.getData=function(){  
        return data;  
    }  
      
} 